<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>Skilful: Исходный файл Skilful/Data/QuotesManager.cs</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javaScript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body onload='searchBox.OnSelectItem(0);'>
<!-- Создано системой Doxygen 1.7.1 -->
<script type="text/javascript"><!--
var searchBox = new SearchBox("searchBox", "search",false,'Поиск');
--></script>
<div class="navigation" id="top">
  <div class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Титульная&nbsp;страница</span></a></li>
      <li><a href="namespaces.html"><span>Пакеты</span></a></li>
      <li><a href="annotated.html"><span>Классы</span></a></li>
      <li class="current"><a href="files.html"><span>Файлы</span></a></li>
      <li><a href="dirs.html"><span>Алфавитный&nbsp;указатель&nbsp;директорий</span></a></li>
      <li id="searchli">
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Поиск" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>Файлы</span></a></li>
    </ul>
  </div>
  <div class="navpath">
    <ul>
      <li><a class="el" href="dir_7adcdc1edff7620168fbc20357cad448.html">Skilful</a>      </li>
      <li><a class="el" href="dir_c777626736fbbff11bce263deda591b3.html">Data</a>      </li>
    </ul>
  </div>
</div>
<div class="header">
  <div class="headertitle">
<h1>QuotesManager.cs</h1>  </div>
</div>
<div class="contents">
<a href="_quotes_manager_8cs.html">См. документацию.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 ﻿<span class="comment">//---------------------------------------------------------------------------------------------------------------</span>
<a name="l00002"></a>00002 <span class="comment">// Skilful. Tactica Adversa graphic and analysis tool.</span>
<a name="l00003"></a>00003 <span class="comment">// Copyright (C) 2010 &quot;...&quot;, Andrey Prokhorov (AVP), Andrey Zyablitsev (skat)</span>
<a name="l00004"></a>00004 <span class="comment">//</span>
<a name="l00005"></a>00005 <span class="comment">// This program is free software; you can redistribute it and/or</span>
<a name="l00006"></a>00006 <span class="comment">// modify it under the terms of the GNU General Public License</span>
<a name="l00007"></a>00007 <span class="comment">// as published by the Free Software Foundation; either version 2</span>
<a name="l00008"></a>00008 <span class="comment">// of the License, or (at your option) any later version.</span>
<a name="l00009"></a>00009 <span class="comment">//</span>
<a name="l00010"></a>00010 <span class="comment">// This program is distributed in the hope that it will be useful,</span>
<a name="l00011"></a>00011 <span class="comment">// but WITHOUT ANY WARRANTY; without even the implied warranty of</span>
<a name="l00012"></a>00012 <span class="comment">// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the</span>
<a name="l00013"></a>00013 <span class="comment">// GNU General Public License for more details.</span>
<a name="l00014"></a>00014 <span class="comment">//</span>
<a name="l00015"></a>00015 <span class="comment">// You should have received a copy of the GNU General Public License</span>
<a name="l00016"></a>00016 <span class="comment">// along with this program; if not, write to the Free Software</span>
<a name="l00017"></a>00017 <span class="comment">// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.</span>
<a name="l00018"></a>00018 <span class="comment">//</span>
<a name="l00019"></a>00019 <span class="comment">// mail: support@protoforma.com </span>
<a name="l00020"></a>00020 <span class="comment">//---------------------------------------------------------------------------------------------------------------</span>
<a name="l00021"></a>00021 
<a name="l00022"></a>00022 
<a name="l00023"></a>00023 <span class="keyword">using</span> System;
<a name="l00024"></a>00024 <span class="keyword">using</span> System.Collections.Generic;
<a name="l00025"></a>00025 <span class="keyword">using</span> System.Linq;
<a name="l00026"></a>00026 <span class="keyword">using</span> System.Text;
<a name="l00027"></a>00027 <span class="keyword">using</span> System.Windows.Forms;
<a name="l00028"></a>00028 <span class="keyword">using</span> Skilful;
<a name="l00029"></a>00029 <span class="keyword">using</span> Skilful.Data;
<a name="l00030"></a>00030 <span class="keyword">using</span> ChartV2;
<a name="l00031"></a>00031 <span class="keyword">using</span> System.Threading;
<a name="l00032"></a>00032 <span class="keyword">using</span> System.Xml;
<a name="l00033"></a>00033 <span class="keyword">using</span> System.IO;
<a name="l00034"></a>00034 
<a name="l00035"></a><a class="code" href="namespace_skilful_1_1_quotes_manager.html">00035</a> <span class="keyword">namespace </span>Skilful.QuotesManager
<a name="l00036"></a>00036 {
<a name="l00037"></a>00037     <span class="comment">//менеджер котировок</span>
<a name="l00038"></a><a class="code" href="class_skilful_1_1_quotes_manager_1_1_m_data_manager.html">00038</a>     <span class="keyword">public</span> <span class="keyword">class </span><a class="code" href="class_skilful_1_1_quotes_manager_1_1_m_data_manager.html">MDataManager</a>
<a name="l00039"></a>00039     {
<a name="l00040"></a><a class="code" href="class_skilful_1_1_quotes_manager_1_1_m_data_manager.html#a7478797cf58c1d301f378a05f3a1ce3e">00040</a>         <span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">event</span> <a class="code" href="namespace_skilful.html#abba84a9cb226ffe788911f3d40f8a33b">NewTickHandler</a> Chart_NewTick;
<a name="l00041"></a><a class="code" href="class_skilful_1_1_quotes_manager_1_1_m_data_manager.html#ac3eefb1ae52915eaf68ff5b5ed11a0ad">00041</a>         <span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">event</span> <a class="code" href="namespace_skilful.html#afa028ff8810ba3dd5607507e8ec1aca2">NewBarHandler</a> Chart_NewBar;
<a name="l00042"></a><a class="code" href="class_skilful_1_1_quotes_manager_1_1_m_data_manager.html#a5efdaf4033edfee419744035b3ca8c7f">00042</a>         <span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">event</span> <a class="code" href="namespace_skilful.html#aa18f7e24d8e44ea6f27601a10812ce10">LibMsgHandler</a> MainForm_MessageBox;
<a name="l00043"></a><a class="code" href="class_skilful_1_1_quotes_manager_1_1_m_data_manager.html#a7d2630ca45a77eb4cdb827bde979a601">00043</a>         <span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">event</span> <a class="code" href="namespace_skilful.html#af55054eca37e69b97a367fed9c074fa1">RefreshHistoryHandler</a> RefreshHistory;
<a name="l00044"></a>00044 
<a name="l00045"></a>00045         <span class="comment">//---------------------------------------------------------------//</span>
<a name="l00054"></a><a class="code" href="class_skilful_1_1_quotes_manager_1_1_m_data_manager.html#a45945683433e46f4f4fcc15bb46cf2ba">00054</a> <span class="comment"></span>        <span class="keyword">public</span> <span class="keyword">static</span> <span class="keywordtype">void</span> RecieveNewTick(<span class="keywordtype">string</span> SourceName, <span class="keywordtype">string</span> SymbolName, DateTime time, <span class="keywordtype">double</span> bid, <span class="keywordtype">double</span> ask)
<a name="l00055"></a>00055         {
<a name="l00056"></a>00056             <span class="keywordflow">if</span> (Chart_NewTick != null) Chart_NewTick(SourceName, SymbolName, time, bid, ask);
<a name="l00057"></a>00057         }
<a name="l00058"></a>00058         
<a name="l00066"></a><a class="code" href="class_skilful_1_1_quotes_manager_1_1_m_data_manager.html#a2fb337e6726f99f28168da612203f690">00066</a>         <span class="keyword">public</span> <span class="keyword">static</span> <span class="keywordtype">void</span> RecieveNewBar(<span class="keywordtype">string</span> SourceName, <span class="keywordtype">string</span> SymbolName, <a class="code" href="namespace_skilful_1_1_quotes_manager.html#a5c84c6ba01636871f8f98492b465c315">TF</a> frame, <span class="keywordtype">double</span>[] bar, <span class="keywordtype">bool</span> completed)
<a name="l00067"></a>00067         {
<a name="l00068"></a>00068             <span class="keywordflow">if</span> (frame &gt;= <a class="code" href="namespace_skilful_1_1_quotes_manager.html#a5c84c6ba01636871f8f98492b465c315">TF</a>.count) <span class="keywordflow">return</span>; <span class="comment">//фрейм не входит в набор стандартных</span>
<a name="l00069"></a>00069             <a class="code" href="class_skilful_1_1_quotes_manager_1_1_t_symbol.html">TSymbol</a> sym = getTSymbol(SourceName, SymbolName);
<a name="l00070"></a>00070             <span class="keywordflow">if</span> (sym != null &amp;&amp; Chart_NewBar != null)
<a name="l00071"></a>00071                 <span class="keywordflow">for</span> (<a class="code" href="namespace_chart_v2.html#a813b22baa4da3db343ab2ee8f39c442b">ChartType</a> ctype = 0; ctype &lt; <a class="code" href="namespace_chart_v2.html#a813b22baa4da3db343ab2ee8f39c442b">ChartType</a>.count; ctype++)
<a name="l00072"></a>00072                     <span class="keywordflow">for</span> (<a class="code" href="namespace_skilful_1_1_quotes_manager.html#a5c84c6ba01636871f8f98492b465c315">TF</a> tf = frame; tf &lt; <a class="code" href="namespace_skilful_1_1_quotes_manager.html#a5c84c6ba01636871f8f98492b465c315">TF</a>.count; tf++)
<a name="l00073"></a>00073                     {
<a name="l00074"></a>00074                         <span class="keywordtype">int</span> idx = sym.<a class="code" href="class_skilful_1_1_quotes_manager_1_1_t_symbol.html#ad69417cc22a5bc2ce4e3778dd3e8aea7">NewBar</a>(ctype, frame, tf, bar);
<a name="l00075"></a>00075                         <span class="keywordflow">if</span>(idx&gt;=0)
<a name="l00076"></a>00076                             Chart_NewBar(SourceName, SymbolName, tf, idx);
<a name="l00077"></a>00077                     }
<a name="l00078"></a>00078         }
<a name="l00086"></a><a class="code" href="class_skilful_1_1_quotes_manager_1_1_m_data_manager.html#a3cf930aaaeda95eaa1e3a2f847bcc7ff">00086</a>         <span class="keyword">public</span> <span class="keyword">static</span> <span class="keywordtype">void</span> LibMsgReciever(<span class="keywordtype">string</span> SourceName, <span class="keywordtype">string</span> SymbolName, <span class="keywordtype">int</span> code, <span class="keywordtype">string</span> text)
<a name="l00087"></a>00087         {
<a name="l00088"></a>00088             <span class="keywordflow">if</span> (MainForm_MessageBox != null) MainForm_MessageBox(SourceName, SymbolName, code, text);
<a name="l00089"></a>00089         }
<a name="l00090"></a>00090         <span class="comment">//---------------------------------------------------------------//</span>
<a name="l00091"></a>00091 
<a name="l00092"></a><a class="code" href="class_skilful_1_1_quotes_manager_1_1_m_data_manager.html#ac448924e1fc03e09fca2a4a57072d6cd">00092</a>         <span class="keyword">public</span> <span class="keywordtype">void</span> RefreshHistoryData(<span class="keywordtype">string</span> SourceName, <span class="keywordtype">string</span> SymbolName)
<a name="l00093"></a>00093         {
<a name="l00094"></a>00094             <span class="keywordflow">if</span> (RefreshHistory != null) RefreshHistory(SourceName, SymbolName);
<a name="l00095"></a>00095         }
<a name="l00096"></a>00096 
<a name="l00097"></a><a class="code" href="class_skilful_1_1_quotes_manager_1_1_m_data_manager.html#ac62fcb90b148661c02f211b01fe5feeb">00097</a>         <span class="keyword">public</span> <a class="code" href="class_skilful_1_1_data_1_1_data_source_library_loader.html">DataSourceLibraryLoader</a> DataSource; <span class="comment">//SourceModules list</span>
<a name="l00098"></a>00098 
<a name="l00099"></a>00099         <span class="comment">//Hash&lt;key,Hash&lt;key,val&gt;&gt;Config -- SourceModuleName=&gt;{key=&gt;value,...}</span>
<a name="l00100"></a><a class="code" href="class_skilful_1_1_quotes_manager_1_1_m_data_manager.html#addcc20e5aced7933be882305a4f7a291">00100</a>         <span class="keyword">public</span> Dictionary&lt;string, Dictionary&lt;string, string&gt;&gt; Config = <span class="keyword">new</span> Dictionary&lt;string, Dictionary&lt;string, string&gt;&gt;();
<a name="l00101"></a>00101 
<a name="l00102"></a>00102         <span class="comment">//base list of opened/calculated symbols</span>
<a name="l00103"></a>00103         <span class="keyword">static</span> List&lt;TSymbol&gt; SymList = <span class="keyword">new</span> List&lt;TSymbol&gt;();
<a name="l00104"></a><a class="code" href="class_skilful_1_1_quotes_manager_1_1_m_data_manager.html#a869c7ef5ccd81be5deb05d263657651e">00104</a>         <span class="keyword">public</span> <a class="code" href="class_skilful_1_1_quotes_manager_1_1_m_data_manager.html">MDataManager</a>(<a class="code" href="namespace_skilful.html#abba84a9cb226ffe788911f3d40f8a33b">NewTickHandler</a> MainForm_Tick2Chart, <a class="code" href="namespace_skilful.html#afa028ff8810ba3dd5607507e8ec1aca2">NewBarHandler</a> MainForm_Bar2Chart, <a class="code" href="namespace_skilful.html#aa18f7e24d8e44ea6f27601a10812ce10">LibMsgHandler</a> MFMessageBox, <a class="code" href="namespace_skilful.html#af55054eca37e69b97a367fed9c074fa1">RefreshHistoryHandler</a> MFRefreshHistory)
<a name="l00105"></a>00105         {
<a name="l00106"></a>00106             DataSource = <span class="keyword">new</span> <a class="code" href="class_skilful_1_1_data_1_1_data_source_library_loader.html">DataSourceLibraryLoader</a>();
<a name="l00107"></a>00107             Config_Init();
<a name="l00108"></a>00108             Chart_NewTick += MainForm_Tick2Chart;
<a name="l00109"></a>00109             Chart_NewBar += MainForm_Bar2Chart;
<a name="l00110"></a>00110             MainForm_MessageBox += MFMessageBox;
<a name="l00111"></a>00111             RefreshHistory += MFRefreshHistory;
<a name="l00112"></a>00112         }
<a name="l00113"></a>00113 
<a name="l00123"></a><a class="code" href="class_skilful_1_1_quotes_manager_1_1_m_data_manager.html#a81efd293d62dc9a4df5364d67b7d08ba">00123</a>         <span class="keyword">public</span> <a class="code" href="class_skilful_1_1_quotes_manager_1_1_t_symbol.html">TSymbol</a> GetSymbol(<a class="code" href="class_skilful_1_1_data_1_1_data_sourse_module.html">DataSourseModule</a> module, <span class="keywordtype">string</span> SymbolName)
<a name="l00124"></a>00124         {
<a name="l00125"></a>00125             <span class="comment">//get existing</span>
<a name="l00126"></a>00126             <a class="code" href="class_skilful_1_1_quotes_manager_1_1_t_symbol.html">TSymbol</a> sym = getTSymbol(module.<a class="code" href="class_skilful_1_1_data_1_1_data_sourse_module.html#ae455c83d61949d579014ed7251fca5f2">name</a>, SymbolName);
<a name="l00127"></a>00127             <span class="keywordflow">if</span>(sym!=null) <span class="keywordflow">return</span>(sym);
<a name="l00128"></a>00128             <span class="comment">//or create new</span>
<a name="l00129"></a>00129             <span class="comment">//version for importing data //also need version for local_stored + online data</span>
<a name="l00130"></a>00130             SymList.Add(<span class="keyword">new</span> <a class="code" href="class_skilful_1_1_quotes_manager_1_1_t_symbol.html">TSymbol</a>(module, SymbolName, RefreshHistory));
<a name="l00131"></a>00131 
<a name="l00132"></a>00132             <span class="comment">//subscribe for online data</span>
<a name="l00133"></a>00133             module.<a class="code" href="class_skilful_1_1_data_1_1_data_sourse_module.html#ac11025d62edc67cb69873505d9d38338" title="функция предопределена для передачи тиков и баров в реальном времени вызов автоматически при создании...">SetTickHandler</a>(SymbolName);
<a name="l00134"></a>00134             <span class="comment">//</span>
<a name="l00135"></a>00135             <span class="comment">//также существует функция module.RemTickHandler(SymbolName);</span>
<a name="l00136"></a>00136             <span class="comment">//для отключения символа от реалтайм потока</span>
<a name="l00137"></a>00137             <span class="comment">//</span>
<a name="l00138"></a>00138             <span class="keywordflow">return</span> SymList.Last();
<a name="l00139"></a>00139         }
<a name="l00140"></a>00140 
<a name="l00147"></a>00147         <span class="keyword">static</span> <a class="code" href="class_skilful_1_1_quotes_manager_1_1_t_symbol.html">TSymbol</a> getTSymbol(<span class="keywordtype">string</span> ModuleName, <span class="keywordtype">string</span> SymbolName)
<a name="l00148"></a>00148         {
<a name="l00149"></a>00149             <span class="keywordflow">foreach</span> (<a class="code" href="class_skilful_1_1_quotes_manager_1_1_t_symbol.html">TSymbol</a> sym <span class="keywordflow">in</span> SymList)
<a name="l00150"></a>00150                 <span class="keywordflow">if</span> (sym.<a class="code" href="class_skilful_1_1_quotes_manager_1_1_t_symbol.html#a4391c12ef4494e4b721b9a0984a60f19">moduleName</a> == ModuleName &amp;&amp; sym.<a class="code" href="class_skilful_1_1_quotes_manager_1_1_t_symbol.html#a8819d874656f3799a3e08da562d127bd" title="Название символа.">Name</a> == SymbolName) <span class="keywordflow">return</span> sym;
<a name="l00151"></a>00151             <span class="keywordflow">return</span> (<a class="code" href="class_skilful_1_1_quotes_manager_1_1_t_symbol.html">TSymbol</a>)null;
<a name="l00152"></a>00152         }
<a name="l00153"></a>00153         
<a name="l00154"></a>00154         <span class="comment">//---------------------------------------------------------------//</span>
<a name="l00159"></a><a class="code" href="class_skilful_1_1_quotes_manager_1_1_m_data_manager.html#acdec7de9f2c8ed005123404548da1fc7">00159</a> <span class="comment"></span>        <span class="keyword">public</span> <span class="keywordtype">void</span> Config_Init()
<a name="l00160"></a>00160         {
<a name="l00161"></a>00161             <span class="keywordtype">string</span> config = <a class="code" href="class_skilful_1_1_x_m_l_config.html">XMLConfig</a>.Get(<span class="stringliteral">&quot;DataSourceLibraries&quot;</span>);
<a name="l00162"></a>00162             <span class="keywordflow">if</span> (config.Length == 0) <span class="keywordflow">return</span>;
<a name="l00163"></a>00163             <span class="comment">//parse config string</span>
<a name="l00164"></a>00164             <span class="comment">//string config = &quot;modulename^checked&gt;bool,prompt&gt;string[;...]&quot;;</span>
<a name="l00165"></a>00165             <span class="keywordtype">char</span> delim = config.IndexOf(<span class="charliteral">&#39;|&#39;</span>) &gt; 0 ? <span class="charliteral">&#39;|&#39;</span> : <span class="charliteral">&#39;;&#39;</span>;
<a name="l00166"></a>00166             <span class="keywordflow">foreach</span> (<span class="keywordtype">string</span> a <span class="keywordflow">in</span> config.Split(delim))
<a name="l00167"></a>00167             {
<a name="l00168"></a>00168                 Dictionary&lt;string, string&gt; child = <span class="keyword">new</span> Dictionary&lt;string, string&gt;();
<a name="l00169"></a>00169                 <span class="keywordtype">string</span>[] b = a.Split(<span class="charliteral">&#39;^&#39;</span>);
<a name="l00170"></a>00170                 <span class="keywordflow">if</span> (b.Length != 2) <span class="keywordflow">continue</span>;
<a name="l00171"></a>00171                 <span class="keywordtype">char</span> splitter = config.IndexOf(<span class="charliteral">&#39;~&#39;</span>) &gt; 0 ? <span class="charliteral">&#39;~&#39;</span> : <span class="charliteral">&#39;,&#39;</span>;
<a name="l00172"></a>00172                 <span class="keywordflow">foreach</span> (<span class="keywordtype">string</span> c <span class="keywordflow">in</span> b[1].Split(splitter))
<a name="l00173"></a>00173                 {
<a name="l00174"></a>00174                     <span class="keywordtype">string</span>[] d = c.Split(<span class="charliteral">&#39;&gt;&#39;</span>);
<a name="l00175"></a>00175                     <span class="keywordflow">if</span> (d.Length == 2) child.Add(d[0], d[1]);
<a name="l00176"></a>00176                 }
<a name="l00177"></a>00177                 Config.Add(b[0], child);
<a name="l00178"></a>00178             }
<a name="l00179"></a>00179         }
<a name="l00180"></a>00180         <span class="comment">//---------------------------------------------------------------//</span>
<a name="l00185"></a><a class="code" href="class_skilful_1_1_quotes_manager_1_1_m_data_manager.html#a172101a92b6bd7366c4d9d67834fede7">00185</a> <span class="comment"></span>        <span class="keyword">public</span> <span class="keywordtype">void</span> Config_Save()
<a name="l00186"></a>00186         {
<a name="l00187"></a>00187             <span class="comment">//join hash to string function</span>
<a name="l00188"></a>00188             <span class="keywordtype">string</span> hash = <span class="stringliteral">&quot;&quot;</span>;
<a name="l00189"></a>00189             <span class="keywordflow">foreach</span> (<span class="keywordtype">string</span> a <span class="keywordflow">in</span> Config.Keys)
<a name="l00190"></a>00190             {
<a name="l00191"></a>00191                 hash = hash.Length == 0 ? a : hash + <span class="stringliteral">&quot;|&quot;</span> + a;
<a name="l00192"></a>00192                 <span class="keywordtype">string</span> val = <span class="stringliteral">&quot;&quot;</span>;
<a name="l00193"></a>00193                 <span class="keywordflow">foreach</span> (<span class="keywordtype">string</span> b <span class="keywordflow">in</span> Config[a].Keys)
<a name="l00194"></a>00194                 {
<a name="l00195"></a>00195                     <span class="keywordflow">if</span> (val.Length &gt; 0) val += <span class="stringliteral">&quot;~&quot;</span>;
<a name="l00196"></a>00196                     val += b + <span class="stringliteral">&quot;&gt;&quot;</span> + Config[a][b];
<a name="l00197"></a>00197                 }
<a name="l00198"></a>00198                 hash += <span class="stringliteral">&quot;^&quot;</span> + val;
<a name="l00199"></a>00199             }
<a name="l00200"></a>00200             <a class="code" href="class_skilful_1_1_x_m_l_config.html">XMLConfig</a>.Set(<span class="stringliteral">&quot;DataSourceLibraries&quot;</span>, hash);
<a name="l00201"></a>00201         }
<a name="l00202"></a>00202         
<a name="l00203"></a>00203         <span class="comment">//---------------------------------------------------------------//</span>
<a name="l00204"></a>00204         <span class="comment">//эта функция создана специально для  МТ4контрол. (Выдрана из Tools-&gt;SelectDataSource)</span>
<a name="l00205"></a>00205         <span class="comment">//в остальных случаях путь устанавливается в диалоге Tools-&gt;SelectDataSource</span>
<a name="l00206"></a>00206         <span class="comment">//</span>
<a name="l00207"></a>00207         <span class="comment">// DataManager.SetNewDataSourceFilePath(&quot;MT4&quot;, &quot;c:\\progra~1\\mt4\\experts\\files&quot;);</span>
<a name="l00208"></a>00208         <span class="comment">//</span>
<a name="l00209"></a><a class="code" href="class_skilful_1_1_quotes_manager_1_1_m_data_manager.html#a612f72a1f9a730eca54f5b998ce72ca4">00209</a>         <span class="keyword">public</span> <span class="keywordtype">bool</span> SetNewDataSourceFilePath(<span class="keywordtype">string</span> ModuleName, <span class="keywordtype">string</span> new_filespath)
<a name="l00210"></a>00210         {
<a name="l00211"></a>00211             <a class="code" href="class_skilful_1_1_data_1_1_data_sourse_module.html">DataSourseModule</a> mod = DataSource[ModuleName];
<a name="l00212"></a>00212             <span class="keywordflow">if</span> (mod != null)
<a name="l00213"></a>00213             {
<a name="l00214"></a>00214                 mod.<a class="code" href="class_skilful_1_1_data_1_1_data_sourse_module.html#a03969fa5f1c1882d5864ec1d2b19a095">prompt</a> = new_filespath;
<a name="l00215"></a>00215 
<a name="l00216"></a>00216                 <span class="comment">//save settings // </span>
<a name="l00217"></a>00217                 Dictionary&lt;string, string&gt; param;
<a name="l00218"></a>00218                 <span class="keywordflow">if</span> (Config.TryGetValue(ModuleName, out param))
<a name="l00219"></a>00219                 {
<a name="l00220"></a>00220                     param[<span class="stringliteral">&quot;prompt&quot;</span>] = new_filespath;
<a name="l00221"></a>00221                     param[<span class="stringliteral">&quot;checked&quot;</span>] = <span class="stringliteral">&quot;1&quot;</span>;
<a name="l00222"></a>00222                 }
<a name="l00223"></a>00223                 <span class="keywordflow">else</span>
<a name="l00224"></a>00224                 {
<a name="l00225"></a>00225                     param = <span class="keyword">new</span> Dictionary&lt;string, string&gt;();
<a name="l00226"></a>00226                     param.Add(<span class="stringliteral">&quot;prompt&quot;</span>, new_filespath);
<a name="l00227"></a>00227                     param.Add(<span class="stringliteral">&quot;checked&quot;</span>, <span class="stringliteral">&quot;1&quot;</span>);
<a name="l00228"></a>00228                     Config.Add(ModuleName, param);
<a name="l00229"></a>00229                 }
<a name="l00230"></a>00230                 Config_Save();
<a name="l00231"></a>00231                 <span class="keywordflow">return</span> <span class="keyword">true</span>;
<a name="l00232"></a>00232             }
<a name="l00233"></a>00233             <span class="keywordflow">return</span> <span class="keyword">false</span>;
<a name="l00234"></a>00234         }
<a name="l00235"></a>00235         
<a name="l00236"></a>00236         <span class="comment">//---------------------------------------------------------------//</span>
<a name="l00242"></a><a class="code" href="class_skilful_1_1_quotes_manager_1_1_m_data_manager.html#a90a5460a3375b4d5ba8320484ef70b34">00242</a> <span class="comment"></span>        <span class="keyword">public</span> <span class="keywordtype">string</span>[] GetSymbolList(<span class="keywordtype">int</span> i)
<a name="l00243"></a>00243         {
<a name="l00244"></a>00244             Dictionary&lt;string, string&gt; config;
<a name="l00245"></a>00245             <span class="keywordtype">string</span> prompt = <span class="stringliteral">&quot;&quot;</span>, @checked = <span class="stringliteral">&quot;&quot;</span>;
<a name="l00246"></a>00246             <span class="keywordflow">if</span> (i &gt;= 0 &amp;&amp; i &lt; DataSource.Count())
<a name="l00247"></a>00247                 <span class="keywordflow">if</span> (Config.TryGetValue(DataSource[i].name, out config))
<a name="l00248"></a>00248                     <span class="keywordflow">if</span> (config.TryGetValue(<span class="stringliteral">&quot;prompt&quot;</span>, out prompt))
<a name="l00249"></a>00249                         <span class="keywordflow">if</span> (config.TryGetValue(<span class="stringliteral">&quot;checked&quot;</span>, out @checked))
<a name="l00250"></a>00250                             <span class="keywordflow">if</span> (@checked == <span class="stringliteral">&quot;1&quot;</span> &amp;&amp; prompt != DataSource[i].prompt)
<a name="l00251"></a>00251                                 <span class="keywordflow">return</span> DataSource[i].get_symbol_list(prompt);
<a name="l00252"></a>00252             <span class="keywordflow">return</span> <span class="keyword">new</span> <span class="keywordtype">string</span>[0];
<a name="l00253"></a>00253         }
<a name="l00254"></a>00254         
<a name="l00255"></a>00255         <span class="comment">//---------------------------------------------------------------//</span>
<a name="l00256"></a><a class="code" href="class_skilful_1_1_quotes_manager_1_1_m_data_manager.html#a2a80edd87866a34041ec8fc9d13a0801">00256</a>         <span class="keyword">public</span> DateTime GetLastTime(<span class="keywordtype">string</span> SourceName, <span class="keywordtype">string</span> SymbolName, <a class="code" href="namespace_skilful_1_1_quotes_manager.html#a5c84c6ba01636871f8f98492b465c315">TF</a> frame,out <span class="keywordtype">int</span> lastindex)
<a name="l00257"></a>00257         {
<a name="l00258"></a>00258             <span class="comment">//DateTime tm;</span>
<a name="l00259"></a>00259             <a class="code" href="class_skilful_1_1_quotes_manager_1_1_t_symbol.html">TSymbol</a> sym = getTSymbol(SourceName, SymbolName);
<a name="l00260"></a>00260             lastindex = 0;
<a name="l00261"></a>00261             <span class="keywordflow">if</span> (sym != null)
<a name="l00262"></a>00262             {
<a name="l00263"></a>00263                 <a class="code" href="class_skilful_1_1_quotes_manager_1_1_t_quotes.html" title="Класс хранит массив которивок для заданного фрейма также массивы моделей, протоформ и некоторые допол...">TQuotes</a> qts = sym.<a class="code" href="class_skilful_1_1_quotes_manager_1_1_t_symbol.html#a58899266fdc033e08e63b5cfec6495d8" title="массивы котировок TQuotes[ChartType, TimeFrame].">Frames</a>[(int)<a class="code" href="namespace_chart_v2.html#a813b22baa4da3db343ab2ee8f39c442b">ChartType</a>.Candle, (<span class="keywordtype">int</span>)frame];
<a name="l00264"></a>00264                 lastindex = qts.<a class="code" href="class_skilful_1_1_quotes_manager_1_1_t_quotes.html#a69e86cf05b4e50c62e5dc0bb012de9b2">lastindex</a> - 1;
<a name="l00265"></a>00265                 <span class="keywordflow">return</span> qts[qts.<a class="code" href="class_skilful_1_1_quotes_manager_1_1_t_quotes.html#a69e86cf05b4e50c62e5dc0bb012de9b2">lastindex</a> - 2].DT;
<a name="l00266"></a>00266             }
<a name="l00267"></a>00267             <span class="keywordflow">return</span> DateTime.Now;
<a name="l00268"></a>00268         }
<a name="l00269"></a>00269 
<a name="l00270"></a>00270         <span class="comment">//---------------------------------------------------------------//</span>
<a name="l00271"></a><a class="code" href="class_skilful_1_1_quotes_manager_1_1_m_data_manager.html#a587a8c21c781460c593fc217fd6261a4">00271</a>         <span class="keyword">public</span> <span class="keywordtype">void</span> SetPipValue(<span class="keywordtype">string</span> SourceName, <span class="keywordtype">string</span> SymbolName, <span class="keywordtype">int</span> digits)
<a name="l00272"></a>00272         {
<a name="l00273"></a>00273             <a class="code" href="class_skilful_1_1_quotes_manager_1_1_t_symbol.html">TSymbol</a> sym = getTSymbol(SourceName, SymbolName);
<a name="l00274"></a>00274             <span class="keywordflow">if</span> (sym != null)
<a name="l00275"></a>00275                 sym.<a class="code" href="class_skilful_1_1_quotes_manager_1_1_t_symbol.html#af7832f365811be20522aac9efa2026a0">setPipValue</a>(digits);
<a name="l00276"></a>00276         }
<a name="l00277"></a>00277     }
<a name="l00278"></a>00278 }
<a name="l00279"></a>00279                                                                         
</pre></div></div>
</div>
<!--- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&nbsp;</span>Указатель</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&nbsp;</span>Классы</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&nbsp;</span>Пространства имен</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&nbsp;</span>Файлы</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&nbsp;</span>Функции</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&nbsp;</span>Переменные</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&nbsp;</span>Перечисления</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark">&nbsp;</span>Свойства</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark">&nbsp;</span>События</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<hr class="footer"/><address class="footer"><small>Создано системой&nbsp;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.1 </small></address>
</body>
</html>
